package com.zzq.controller;

import com.zzq.domain.search.PointGoodsSearchParamet;
import com.zzq.result.SmileResult;
import com.zzq.service.impl.ClientBlindboxServiceImpl;
import com.zzq.service.impl.ClientGoodsServiceImpl;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.security.auth.login.LoginException;

@RequestMapping("/client/goods")
@RestController
@Api(value = "积分商城",tags = {"积分商城"})
public class ClientGoodsController {
    @Autowired
    ClientGoodsServiceImpl goodsService;
    @Autowired
    ClientBlindboxServiceImpl blindboxService;

    @PostMapping("/list")
    @ApiOperation("积分商城列表")
    public SmileResult getClientGoodsDTOList(@RequestBody PointGoodsSearchParamet searchParamet){
       return goodsService.getPointGoodsDTOList(searchParamet);
    }
    @GetMapping("/buy")
    @ApiOperation("购买")
    public SmileResult getClientGoodsDTOList(@RequestParam("clientNo") String clientNo,@RequestParam("goodsId") Long goodsId){
        return goodsService.buyGoodsByPoint(clientNo,goodsId);
    }

    @GetMapping("/prize")
    @ApiOperation("盲盒")
    public SmileResult prizeDraw(String clientNo) throws LoginException {
        return blindboxService.prizeDraw(clientNo);
    }


}
